<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <div id="app">
        <button @click="fn1">点我</button>
    </div>

    <script src="./vue.js"></script>

    <script>
        new Vue ({
            el: '#app',
            data: {
                msg: '马杀鸡'
            },
            methods: {

                fn1 () {
                    // vue里的this是当前vue实例
                    // vue实例会在某个阶段把data里的变量以及methods里的方法全部都挂载到这个实例的最外层
                    console.log(this.msg)

                    this.fn2()
                },

                fn2 () {

                    console.log('我是fn2')
                }
            }
        })
    </script>
</body>
</html>